package com.muyu.cart.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.cart.domain.CartManager;
import com.muyu.cart.domain.req.CartListReq;
import com.muyu.cart.domain.resp.CartListResp;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 购物车Mapper接口
 *
 * @author JiaCheng
 * @version 1.0
 * @since 2025-09-21
 */
@Mapper
public interface CartManagerMapper extends BaseMapper<CartManager> {


    List<CartListResp> selectCartListPage(CartListReq req);

    /**
     * 统计购物车商品数量
     *
     * @param userId 用户ID
     * @return 商品数量
     */
    int countCartItems(@Param("userId") Long userId);

    /**
     * 统计已选中商品数量
     *
     * @param userId 用户ID
     * @return 已选中商品数量
     */
    int countSelectedItems(@Param("userId") Long userId);
}